const ora = require('ora');

class Spin{
    constructor(text){
        this.text = text;
        this.spinner = ora(this.text);
        this.spinner.interval = 200;
    }
    start(){
        this.spinner.start();
    }
    setText(val){
        this.spinner.text = val;
    }
    setColor(color){
        this.spinner.color = color;
    }
    succeed(text){
        this.spinner.succeed(text);
    }
    fail(text){
        this.spinner.fail(text);
    }
}

module.exports = Spin;